package com.shsun.curveapi.domain.dto;

import com.shsun.curveapi.domain.bo.TaskBO;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * add curve dto
 *
 * @author shsun
 * @date 2024/06/11
 */
@Data
public class AddTaskDTO {
    @Schema(description = "任务名称")
    @NotBlank(message = "任务名称不能为空")
    private String taskName;
    @Schema(description = "任务结束时间")
    private LocalDateTime endDate;
    @Schema(description = "任务规则")
    private Long ruleId;

    /**
     * convert
     *
     * @param param param
     * @date 2024/06/13
     * @author shsun
     */
    public static TaskBO convert(AddTaskDTO param) {
        if (param == null) {
            return null;
        }
        TaskBO taskBO = new TaskBO();
        taskBO.setEndDate(param.getEndDate());
        taskBO.setRuleId(param.getRuleId());
        return taskBO;
    }
}
